package cn.lijiguo.concurrency.part1.ch02;

/**
 * TaxCalculatorMain
 *
 * @author lijiguo
 * @date 2019/12/6 15:49
 */
public class TaxCalculatorMain {

    public static void main(String[] args) {
        TaxCalculator taxCalculator = new TaxCalculator(10000.0, 2000.0);
        // 设置个人所得税的计算方式，也可以在构造函数中添加
        taxCalculator.setCalculatorStrategy(new SimpleCalculatorStrategy());
        // 计算个人所得税
        double tax = taxCalculator.calculate();
        System.out.println("应该缴纳的个人所得税是：" + tax);
        System.out.println("--------------------------");

        TaxCalculator taxCalculator2 = new TaxCalculator(10000.0, 2000.0,
                (salary, bonus) -> salary * 0.1 + bonus * 0.15);
        double tax2 = taxCalculator2.calculate();
        System.out.println("应该缴纳的个人所得税是：" + tax2);
    }
}
